﻿
@{
    Layout = null;
}



@using EFEntity
@using Model
@model Esalary_grant_details

@{
    Layout = null;
}
<script src="~/echarts/echarts.min.js"></script>
<script src="~/Scripts/vue.js"></script>
<script src="~/lib/jquery/dist/jquery.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
<link href="~/lib/bootstrap/dist/css/bootstrap.css" rel="stylesheet" />
@********薪酬发放查询*********@

<div id="app">
    <form method="post" action="/salaryGrant/check_success">
        <table width="100%">
            <tr>
                <td colspan="2" style="text-align: left">
                    <font color="black">
                        您正在做的业务是：人力资源--薪酬标准管理--薪酬发放查询
                    </font>
                </td>
                <td>
                    <input type="button" value="返回" onclick="javascript:window.history.back();" class="BUTTON_STYLE1">
                </td>
            </tr>
            @foreach (Esalary_grant aa in ViewBag.es)
            {
                <tr>
                    <td colspan="2" style="text-align: left">
                        薪酬单编号：@aa.salary_standard_id
                        @*<input type="text" asp-for="salary_grant_id" id="salary_grant_id" readonly="readonly">*@
                    </td>
                </tr>
                <tr>
                    <td style="text-align: left">
                        本机构总人数:@aa.human_amount
                        <input type="hidden" name="salaryGrant.humanAmount" value="5">
                        ，基本薪酬总数:@aa.salary_standard_sum
                        ，实发总额:<span id="salarySum_sum">@aa.salary_paid_sum</span>
                        <input type="hidden" id="salaryPaidSum" name="salaryGrant.salaryPaidSum" value="00.00" />

                    </td>
                    <td style="text-align: right;">
                        登记人:<input type="text" name="salaryGrant.register" value="冉冉" size="8" readonly="readonly">
                        登记时间：<span id="Tdate"></span>
                        <input type="hidden" name="salaryGrant.registTime" id="Tdate2">
                    </td>
                </tr>
            }
        </table>


        <table width="100%" border="1" cellpadding=0 cellspacing=1
               bordercolorlight=#848284 bordercolordark=#eeeeee
               class="table table-bordered">
            <tr class="alert-info">
                <td class="TD_STYLE1">
                    <span>序号</span>
                </td>
                <td class="TD_STYLE1">
                    <span>档案编号</span>
                </td>
                <td class="TD_STYLE1">
                    <span>姓名</span>
                </td>

                <td class="TD_STYLE1">
                    薪酬基本明细
                </td>

                <td class="TD_STYLE1" width="7%">
                    奖励金额
                </td>
                <td class="TD_STYLE1" width="7%">
                    销售绩效总额
                </td>
                <td class="TD_STYLE1" width="7%">
                    应扣金额
                </td>
                <td class="TD_STYLE1" width="7%">
                    实发金额
                </td>
            </tr>
            <input type="hidden" id="salaryStandardSum1" name="grantDetails[0].salaryStandardSum" value="@ViewData["num"]" />

            @foreach (Esalary_grant item in ViewBag.es)
            {
                <tr class="TD_STYLE2">
                    <td>
                        @Html.DisplayFor(modelItem => item.salary_grant_id)
                        <input type="hidden" asp-for="salary_standard_sum" value="@item.sgr_id" />
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.salary_standard_id)
                    </td>
                    @foreach (Esalary_standard ss in ViewBag.ss)
                    {
                        <td>
                            @ss.standard_name
                            <input type="hidden" id="standard_id" value="@ss.standard_id" />
                        </td>
                    }
                    <td>
                        <input type="button" v-on:click="SelectsDetails()" value="详细内容" />
                        <input type="hidden" asp-for="grd_id" />
                    </td>

                    <td>
                        <input type="text" asp-for="bouns_sum" readonly="readonly" id="bounsSum1" size="10" />
                    </td>
                    <td>
                        <input type="text" asp-for="sale_sum" readonly="readonly" id="saleSum1" size="10" />
                    </td>
                    <td>
                        <input type="text" asp-for="deduct_sum" readonly="readonly" id="deductSum1" size="10" />
                    </td>
                    <td>
                        <input type="text" asp-for="salary_paid_sum" readonly="readonly" id="salaryPaidSum1" size="10" />
                    </td>
                </tr>
            }
        </table>

    </form>

    @* 薪酬信息单模态框开始 *@
    <div class="modal fade" id="XinChou" tabindex="-1" role="dialog"
         aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title" id="myModalLabel">
                        薪酬标准单详细信息
                    </h4>
                </div>
                <form role="form" id="FormUpdate">
                    <div class="modal-body">
                        <!-- 为 ECharts 准备一个具备大小（宽高）的 DOM -->
                        <div id="main" style="width: 470px;height:310px;"></div>

                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default"
                                data-dismiss="modal">
                            关闭
                        </button>

                    </div>
                </form>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>
    @* 薪酬信息单模态框结束 *@
</div>
<script type="text/javascript">
        var app = new Vue({
            el: "#app",
            data: {
               
            },
            methods: {
                SelectsDetails: function () {
                    var t = this;
                    var stid = $("#standard_id").val();
                    //模态框
                    $('#XinChou').modal('show')

                    var t = this;
                    $.ajax({
                        url: "/salaryGrant/strandedDetails?standardID=" + stid,
                        type: "get",
                        success: function (msg) {
                            var df = eval("(" + msg + ")");

                            t.dt1 = df["name"];
                            t.Sdt = df["salary"];
                            myChart.setOption({
                                legend: {
                                    orient: 'vertical',
                                    right:"70px",
                                    data: t.dt1
                                },
                                itemStyle: {
                                    color: '#00FFFF',
                                    shadowBlur: 200,
                                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                                },
                                series: [{
                                    name: '薪酬',
                                    data: [
                                        { value: t.Sdt[0], name: t.dt1[0], itemStyle: { color: '#4682B4' } },
                                        { value: t.Sdt[1], name: t.dt1[1], itemStyle: { color: '#FF0000' } },
                                        { value: t.Sdt[2], name: t.dt1[2], itemStyle: { color: '#FF00FF' } },
                                        { value: t.Sdt[3], name: t.dt1[3], itemStyle: { color: '#4169E1' } },
                                        { value: t.Sdt[4], name: t.dt1[4], itemStyle: { color: '#1E90FF' } },
                                        { value: t.Sdt[5], name: t.dt1[5], itemStyle: { color: '#00FF7F' } },
                                        { value: t.Sdt[6], name: t.dt1[6], itemStyle: { color: '#c23531' } },
                                    ]
                                }]
                            });
                        }
                    });
                    var myChart = echarts.init(document.getElementById('main'));
                    option = {
                        title: {
                            text: '薪资信息',
                            left: 'center',
                            top: 20,
                            textStyle: {
                                fontSize: 24
                            }

                        },
                        tooltip: {
                            trigger: 'item',
                            formatter: '{a} <br/>{b} : {c} ({d}%)'
                        },

                       /* visualMap: {
                            show: false,
                            min: 1,
                            max: 99999,
                            inRange: {
                                colorLightness: [0, 1]
                            }
                        },*/

                        series: [
                            {
                                type: 'pie',
                                radius: '55%',
                                center: ['50%', '50%'],
                                roseType: 'radius',
                                label: {
                                    fontSize: 14
                                },
                                labelLine: {
                                    smooth: 0.2,
                                    length: 20,
                                    length2: 50
                                },
                                itemStyle: {
                                    color: '#c23531',
                                    shadowBlur: 20,
                                    shadowColor: 'rgba(91, 12, 10, 0.5)'
                                },
                                animationType: 'scale',
                                animationEasing: 'elasticOut',
                                animationDelay: function (idx) {
                                    return Math.random() * 200;
                                }
                            }
                        ]
                    };

                    myChart.setOption(option);
                }
            },
            mounted: function () {
           
            }
        });

    //详细内容
   

    function time() {
        var tdate = document.getElementById("Tdate");
        var d = new Date();
        var y = d.getFullYear();
        var moth = d.getMonth() + 1;
        var date = d.getDate();
        var h = d.getHours();
        var m = d.getMinutes();
        var s = d.getSeconds();
        var hh = 20 - 1 - h;
        var mm = 60 - 1 - m;
        var ss = 60 - s;
        if (hh > 0) {
            mm = mm + 60 * hh;
        }
        if (moth < 10) {
            moth = "0" + moth;
        }
        if (date < 10) {
            date = "0" + date;
        }
        if (h < 10) {
            h = "0" + h;
        }
        if (m < 10) {
            m = "0" + m;
        }
        if (s < 10) {
            s = "0" + s;
        }
        if (mm < 10) {
            mm = "0" + mm;
        }
        if (ss < 10) {
            ss = "0" + ss;
        }

        tdate.innerHTML = y + "-" + moth + "-" + date + " " + h + ":" + m + ":" + s;
        document.getElementById("Tdate2").value = tdate.innerHTML;
    }
    window.onload = time;
    var out = window.setInterval(time, 1000);

    function onKeyPress(i) {
        var size = 5;
        var bounsSum = document.getElementById("bounsSum" + i);
        var saleSum = document.getElementById("saleSum" + i);
        var deductSum = document.getElementById("deductSum" + i);
        var salaryPaidSum = document.getElementById("salaryPaidSum" + i);
        if (isNaN(bounsSum.value) || bounsSum.value < 0) {
            alert("金额填写错误!");
            bounsSum.value = "0.00";
            return;
        }
        if (isNaN(saleSum.value) || saleSum.value < 0) {
            alert("金额填写错误!");
            saleSum.value = "0.00";
            return;
        }
        if (isNaN(deductSum.value) || deductSum.value < 0) {
            alert("金额填写错误!");
            deductSum.value = "0.00";
            return;
        }
        salaryPaidSum.value = Number(bounsSum.value) + Number(saleSum.value) - Number(deductSum.value) + Number(document.getElementById("salaryStandardSum" + i).value);

        var sum = 0;
        for (var j = 1; j <= size; j++) {
            sum = Number(sum) + Number(document.getElementById("salaryPaidSum" + j).value);
        }
        document.getElementById("salarySum_sum").innerHTML = sum;
        document.getElementById("salaryPaidSum").value = sum;

    }

</script>


